﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BioAttendance.Data
{
    public class EmployeeStatus
    {
        private Employee employee;
        
        private Attendance attendance;
        public Attendance Attendance
        {
            get { return this.attendance; }
        }


        public EmployeeStatus(Attendance attendance)
        {
            this.attendance = attendance;
            this.employee = attendance.Employee;
        }

        public int ID
        {
            get{ return this.employee.ID; }
        }

        public String Name
        {
            get{ return this.employee.Name; }
        }

        public String EntryTime
        {
            get 
            {
                return this.attendance.EntryTime.ToString("d MMMM h:m:s tt"); 
            }
        }

        public String TimeElapsed
        {
            get 
            { 
                TimeSpan ts = (DateTime.Now - this.attendance.EntryTime);
                if (ts.Days > 0)
                {
                    return ts.ToString(@"d\d\ hh\:mm");
                }
                else
                {
                    return ts.ToString(@"hh\:mm\:ss");
                }
            }
        }

        public bool Belongs(Attendance att)
        {
            return (this.attendance.ID == att.ID);
        }

        public bool Belongs(Employee emp)
        {
            return (this.employee.ID == emp.ID);
        }
    }
}
